require 'rubygems'
require 'mq'
require 'singleton'

class QueueClient
  include Singleton

  def set_options(options)
    @options = options
  end

  def put(msj)
    puts @options.inspect
    begin
      EM.run {
        #mq server configuration
        AMQP.start(:host => @options[:host], :port => @options[:port] ) do
          amq = MQ.new
          amq.queue(@options[:amqp_queue_name]).publish(msj)
          AMQP.stop {EM.stop}
        end
      }
    rescue
    end
  end
end

